package com.leadingsoft.web.code.utils;

public class CommonUtils {
	public static String getLastEditTime(long timeDifference) {
		StringBuilder resultString = new StringBuilder();
		if (60 >= timeDifference / 1000)
			resultString.append("刚刚");
		if (timeDifference / 1000 / 60 > 0 && 60 >= timeDifference / 1000 / 60)
			resultString.append(timeDifference / 1000 / 60).append("分钟前");
		if (timeDifference / 1000 / 60 / 60 > 0 && 24 >= timeDifference / 1000 / 60 / 60)
			resultString.append(timeDifference / 1000 / 60 / 60).append("小时前");
		if (timeDifference / 1000 / 60 / 60 / 24 > 0 && 30 >= timeDifference / 1000 / 60 / 60 / 24)
			resultString.append(timeDifference / 1000 / 60 / 60 / 24).append("天前");
		if (timeDifference / 1000 / 60 / 60 / 24 / 30 > 0 && 12 >= timeDifference / 1000 / 60 / 60 / 24 / 30)
			resultString.append(timeDifference / 1000 / 60 / 60 / 24 / 30).append("月前");
		if (timeDifference / 1000 / 60 / 60 / 24 / 30 / 12 > 0)
			resultString.append(timeDifference / 1000 / 60 / 60 / 24 / 30 / 12).append("年前");
		return resultString.toString();
	}
}
